from mediator import mediator
from mediator . tests . test_assistant import make_mediator_test_keyword_args

class gui_fake :
    def __init__ ( self ) :
        self . _gui_pack = None
    def gui_pack ( self , widget , padx , pady , fill , side ) :
        self . _gui_pack = [ widget , padx , pady , fill , side ]

class mediator_gui_pack_tests : 
    'mediator_gui_pack'
    def __init__ ( self , test ) :
        self . _test = test
        self . _gui = gui_fake ( )
        self . _mediator = mediator ( )
        self . _mediator . register_modules ( ** make_mediator_test_keyword_args \
            ( 'gui' 
            , self . _gui 
            , None
            ) )
    def test_gui_pack ( self ) :
        self . _mediator . gui_pack ( 'my widget' , 'my padx' , 'my pady' , 'my fill' , 'my side' )
        self . _test . assume_equal ( self . _gui . _gui_pack ,
            [ 'my widget'
            , 'my padx'
            , 'my pady'
            , 'my fill'
            , 'my side'
            ] )
    def test_gui_pack_arg_names ( self ) :
        self . _mediator . gui_pack \
            ( widget = 'my widget' 
            , padx = 'my padx' 
            , pady = 'my pady' 
            , fill = 'my fill' 
            , side = 'my side'
            )
        self . _test . assume_equal ( self . _gui . _gui_pack ,
            [ 'my widget'
            , 'my padx'
            , 'my pady'
            , 'my fill'
            , 'my side'
            ] )
    def test_gui_pack_default_args ( self ) :
        self . _mediator . gui_pack ( 'my widget' ) 
        self . _test . assume_equal ( self . _gui . _gui_pack ,
            [ 'my widget'
            , None
            , None
            , None
            , None
            ] )
